package app.controller.goods;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import app.model.goods.GoodsShoppingcart;
import app.service.goods.GoodsShoppingcartService;
import base.JsonResult;
import base.PageInfo;

@Controller
@RequestMapping("/goodsShoppingcart")
public class GoodsShoppingcartController {
	
	@Resource 
	private GoodsShoppingcartService goodsShoppingcartService;
	
	@ResponseBody
	@RequestMapping("/query.do")
	public PageInfo query(PageInfo pageInfo){
		return goodsShoppingcartService.query(pageInfo);
	}
	
	@ResponseBody
	@RequestMapping("/save.do")
	public JsonResult save(GoodsShoppingcart goodsShoppingcart){
		if(StringUtils.isEmpty(goodsShoppingcart.getId())){
			goodsShoppingcartService.saveEntity(goodsShoppingcart);
		}else{
			goodsShoppingcartService.updateEntity(goodsShoppingcart);
		}
		return new JsonResult("操作成功");
	}

}
